package com.sky.validation.service.impl;

import com.sky.validation.dto.SchoolDto;
import com.sky.validation.util.ValidationUtil;
import com.sky.validation.service.IValidationService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Map;

@Service
public class ValidationServiceImpl implements IValidationService {

    @Override
    public Object test(SchoolDto school) {
        Map<String, Object> map = ValidationUtil.validate(school);
        if (CollectionUtils.isEmpty(map)) {
            return school;
        } else {
            return map;
        }
    }
}
